#include "Cell.h"

#include "Simulation.h"

float CCell::m_Width  = 0;
float CCell::m_Height = 0;

HTEXTURE CCell::GetTexture(const CellType _CellType)
{
  const char * TextureString = NULL;
  switch (_CellType)
  {
    case Empty:
      TextureString = "CellEmpty";
      break;
    case Seat:
      TextureString = "CellSeat";
      break;
    case Exit:
      TextureString = "CellExit";
      break;
    default:
      return NULL;
  }
  return CSimulation::GetInstance()->GetHgeResourceManager()->GetTexture(TextureString);
}

CCell::CCell(
    const float    _X1,
    const float    _Y1,
    const CellType _CellType
  ) :
  m_HgeRect(_X1, _Y1, _X1 + m_Width, _Y1 + m_Height),
  m_CellType(_CellType),
  m_HgeSprite(GetTexture(_CellType), _X1, _Y1, m_Width, m_Height)
{
}

CCell::~CCell()
{
}

void CCell::SetCellType(
    const CellType _CellType
  )
{
  m_CellType = _CellType;
  m_HgeSprite.SetTexture(GetTexture(m_CellType));
}

void CCell::Render()
{
  HGE * hge = CSimulation::GetInstance()->GetHGEObject();
  m_HgeSprite.Render(m_HgeRect.x1, m_HgeRect.y1);
}

void CCell::Update(
      float _TimeDelta
    )
{
}
